- 
          
- 
        Couldn't load subscription status. 
- Fork 1.1k
PR: Add some macros related to working with bytes and bits #536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| 
 | 
| Memory usage change @ f9a3c08 
 Click for full report table
 Click for full report CSV | 
| Nice | 
Description
This PR adds some useful macros for manipulating bytes and bits in C/C++. The existing code already had some macros for low and high bytes, bit reading, setting, clearing, toggling and writing. I added the following macros:
packToInt(h,l): This macro takes two bytes (high and low) and packs them into a 16-bit integer.packToLong(i3,i2,i1,i0): This macro takes four bytes and packs them into a 32-bit long integer.bitIsSet(value, bit): This macro returns true if the given bit in the value is set (1).bitIsClear(value, bit): This macro returns true if the given bit in the value is clear (0).These macros can be useful for working with binary data, such as serial communication, encryption, compression, etc. They can also make the code more readable and concise.
I hope you find this PR useful and I welcome any feedback or suggestions.
Note: This excerpt was generated by ChatGPT. The code is written by me.